package com.webbei.share.action;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.apache.commons.beanutils.converters.DateConverter;
import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;
import com.webbei.share.service.ShareSer;;
public class Comment extends ActionSupport{
	private String comment_content;
	private int production_id;
	private ShareSer ser;
	@SuppressWarnings("deprecation")
	public String Comment() throws IOException{
		//ser.InsertCommentById(production_id);
		String userName="ygh";
		Date now=new Date();
		//SimpleDateFormat from=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		//String time=from.format(now);
		if(ser.InsertComment(production_id, userName, comment_content,now)>0)
		{
			try {
				ServletActionContext.getResponse().getWriter().write("success");
				return null;
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		ServletActionContext.getResponse().getWriter().write("error");
		return null;
	}
	
	public ShareSer getSer() {
		return ser;
	}

	public void setSer(ShareSer ser) {
		this.ser = ser;
	}

	public String getComment_content() {
		return comment_content;
	}

	public void setComment_content(String comment_content) {
		this.comment_content = comment_content;
	}

	public int getProduction_id() {
		return production_id;
	}

	public void setProduction_id(int production_id) {
		this.production_id = production_id;
	}

	
}
